﻿using System;
using System.Data;
using System.Collections.Generic;

namespace Chenxin.Lib.House.BLL
{
    /// <summary>
    /// 业务逻辑类Customer_ViewHouseInfo_tmp 的摘要说明。
    /// </summary>
    public class Customer_ViewHouseInfo_tmp
    {
        public Customer_ViewHouseInfo_tmp()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(Guid RecordId)
        {
            return Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.Exists(RecordId);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static void Add(Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp model)
        {
            Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void Update(Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp model)
        {
            Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static void Delete(Guid RecordId)
        {

            Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp GetModel(Guid RelationId)
        {

            return Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.GetModel(RelationId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static List<Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.House.DAL.Customer_ViewHouseInfo_tmp.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static List<Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp> modelList = new List<Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.House.Entity.Customer_ViewHouseInfo_tmp();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    if (dt.Rows[n]["houseId"].ToString() != "")
                    {
                        model.houseId = new Guid(dt.Rows[n]["houseId"].ToString());
                    }
                    model.HouseCode = dt.Rows[n]["HouseCode"].ToString();
                    model.houseAddress = dt.Rows[n]["houseAddress"].ToString();
                    if (dt.Rows[n]["CustomerId"].ToString() != "")
                    {
                        model.CustomerId = new Guid(dt.Rows[n]["CustomerId"].ToString());
                    }
                    model.CustomerName = dt.Rows[n]["CustomerName"].ToString();
                    model.Community = dt.Rows[n]["Community"].ToString();
                    model.BuildingName = dt.Rows[n]["BuildingName"].ToString();
                    model.Room = dt.Rows[n]["Room"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

